package zhou.cutfruit.models;

import zhou.cutfruit.thread.JamThread;
import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * 果酱类，切掉之后显示
 * 
 * @author 周雨浓
 * 
 */
public class FruitJams {

	int x;
	int y;

	private int index = 0 ;
	
	Bitmap[] bitmaps;

	boolean isShow = false;
	JamThread jamThread ;
	
	Movable fruit ;
	
	
	public FruitJams(Bitmap[] bitmaps , Movable fruit) {
		this.bitmaps = bitmaps;
		this.fruit = fruit;
		jamThread = new JamThread(this);
	}

	public void drawSelf(Canvas canvas) {
		if (bitmaps!=null&&isShow) {
			canvas.drawBitmap(bitmaps[index], fruit.getCuted_x(),fruit.getCuted_y(), null);
			if (index>=bitmaps.length-1) {
				isShow = false;
			}
		}
		
	}
	
	
	
	

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public Bitmap[] getBitmaps() {
		return bitmaps;
	}

	public void setBitmaps(Bitmap[] bitmaps) {
		this.bitmaps = bitmaps;
	}

	public boolean isShow() {
		return isShow;
	}

	public void startShow( ) {
		this.isShow = true;
		jamThread.start();
		
		
	}

	public void stopShow(){
		this.isShow =false;
		
	}
	

}
